<template>
    <div>
     <div class="mui-numbox" data-numbox-min='1' :data-numbox-max='max'>
					<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
                    <!-- 监听input -->
					<input id="test" class="mui-input-numbox" type="number" value="1" @change="countChange" ref="number"/>
					<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
				</div>
    </div>
</template>
<script>
import mui from "../../lib/mui/js/mui.min.js";
export default {
    data() {
        return {
            
        }
    },
    // 当前元素渲染
    mounted(){
     this.mui()
    },
    methods:{
        mui(){
           mui(".mui-numbox").numbox()
        },
        countChange(){
      // console.log(this.$refs.number.value);
       this.$emit("getcount",parseInt(this.$refs.number.value))
       //console.log(this.max);
       
        }
       
    },
    props:["max"],
    watch:{
        "max":function (newval,ondval) {
            mui(".mui-numbox").numbox().setOption('max',newval)
        }
    }
}
</script>
<style lang="scss">

</style>
